/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package vm;

import javax.swing.JTable;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableModel;

/**
 *
 * @author Peer
 */
public class StackTable extends JTable {
    
    TableCellRenderer renderer;

    public StackTable(TableModel dm) {
        super(dm);
        setPrefs();
    }

    public StackTable() {
        super();
        setPrefs();
    }

    @Override
    public TableCellRenderer getCellRenderer(int row, int column) {
        return renderer;
    }

    private void setPrefs() {
        setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
        renderer = new CenterCellRenderer();
        setCellSelectionEnabled(false);
        getTableHeader().setReorderingAllowed(false);
        getTableHeader().setResizingAllowed(false);
        //getColumnModel().getColumn(0).setMaxWidth(getTableHeader().getDefaultRenderer().getTableCellRendererComponent(this, "Cmd", false, false, 0, 0).getPreferredSize().width+4);
    }
}
